projects
/
gtk4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3d2cf97
)
Make the inout argument logic clearer
author
Emmanuele Bassi
<ebassi@gnome.org>
Tue, 26 Jan 2021 12:54:53 +0000
(12:54 +0000)
committer
Emmanuele Bassi
<ebassi@gnome.org>
Tue, 26 Jan 2021 12:54:53 +0000
(12:54 +0000)
It's easy to misread a `+=`.
gdk/gdksurface.c
patch
|
blob
|
history
diff --git
a/gdk/gdksurface.c
b/gdk/gdksurface.c
index 52b45edfd19ac73ce4bb12b6a6e666a50dc83314..aaeb6d21b4299e046ef380c595cf55e46736d0f2 100644
(file)
--- a/
gdk/gdksurface.c
+++ b/
gdk/gdksurface.c
@@
-2980,9
+2980,13
@@
gdk_surface_translate_coordinates (GdkSurface *from,
double *x,
double *y)
{
+ double in_x, in_y, out_x, out_y;
int x1, y1, x2, y2;
GdkSurface *f, *t;
+ in_x = *x;
+ in_y = *y;
+
x1 = 0;
y1 = 0;
f = from;
@@
-3006,8
+3010,11
@@
gdk_surface_translate_coordinates (GdkSurface *from,
if (f != t)
return FALSE;
- *x += x1 - x2;
- *y += y1 - y2;
+ out_x = in_x + (x1 - x2);
+ out_y = in_y + (y1 - y2);
+
+ *x = out_x;
+ *y = out_y;
return TRUE;
}